# Example: Use a Momentary push button

In this example, the Momentary push button controls the state of a valve. The valve can be open, closed, or partially open.

## To configure the valve to be open when the button is not pressed (that is, normally open), and closed when the button is pressed

Create a Momentary push button and select the "Normally open" button action. Add the caption "Open" for State 0 and "Closed" for State 1. Assign a tag to the Value connection.

When the operator presses the button, the application sets the button to State 1 and the caption changes to Closed. The data source registers the change to the tag assigned to the Value connection and closes the valve.

When the operator releases the button or the hold time has elapsed, whichever is later, the application sets the button to State 0 and the caption changes to Open. The data source registers the change to the tag assigned to the Value connection and opens the valve.

## To configure the valve to be closed when the button is not pressed (that is, normally closed), and open when the button is pressed

Create a Momentary push button and select the "Normally closed" button action. Add the caption "Closed" for State 0 and "Open" for State 1.

When the operator presses the button, the application sets the button to State 1 and the caption changes to Open. The data source registers the change to the tag assigned to the Value connection and opens the valve.

When the operator releases the button or the hold time has elapsed, whichever is later, the application sets the button to State 0 and the caption changes to Closed. The data source registers the change to the tag assigned to the Value connection and closes the valve.

## To configure the valve to be closed when the button is not pressed, and open 50% when the button is pressed

Create a Momentary push button and select the Value button action. Change the value for State 0 to 100 and the value for State 1 to 50. Add the caption "Closed" for State 0 and "Open 50%" for State 1.

When the operator presses the button, the application sets the button to State 1 and the caption changes to Open 50%. The data source registers the change to the tag assigned to the Value connection and opens the valve 50%.

When the operator releases the button or the hold time has elapsed, whichever is later, the application sets the button to State 0 and the caption changes to Closed. The data source registers the change to the tag assigned to the Value connection and closes the valve.

## See also

Causes of run-time errors for the Momentary push button

About the Momentary push buttons error state

Create Momentary push buttons

Configure the Momentary push button

Set up states for the Momentary push button

Set up controls for the Momentary push button

How the Momentary push button works at run time